package com.hdax.dmw.pay.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdax.dmw.common.utils.Result;
import com.hdax.dmw.common.utils.ResultGenerator;
import com.hdax.dmw.entity.order.Order;
import com.hdax.dmw.entity.pay.Trade;
import com.hdax.dmw.pay.dtos.ConfirmPayDto;
import com.hdax.dmw.pay.feign.OrderFeign;
import com.hdax.dmw.pay.service.TradeService;
import com.hdax.dmw.pay.mappers.TradeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author guoyisha
* @description 针对表【dm_trade】的数据库操作Service实现
* @createDate 2023-07-30 14:55:58
*/
@Service
public class TradeServiceImpl extends ServiceImpl<TradeMapper, Trade>
    implements TradeService{

    @Autowired
    private OrderFeign orderFeign;

    @Override
    public Result<ConfirmPayDto> confirm(String orderNo) {
        Order detail = orderFeign.detail(orderNo);
        ConfirmPayDto dto = new ConfirmPayDto();
        dto.setOrderNo(detail.getOrderNo());
        dto.setItemName(detail.getItemName());
        dto.setTotalAmount(detail.getTotalAmount());
        return ResultGenerator.genSuccessResult(dto);
    }
}




